import java.util.ArrayList;


public class Cell {
	
	//For Dijkstra's
	//double weight;
	//600 is wider than screen so should be sufficient maximum
	double path;
	Cell parent;
	Line line;
	
	//ArrayList<Line> adjacent = new ArrayList<Line>();
	
	private double midX;
	private double midY;
	
	private ArrayList<Cell> adjacent;
	
	public Cell(Line l)
	{
		midX = l.start_x;
		//Signs???
		midY = l.start_y -(l.start_y - l.end_y)/2;
		//weight = 0;
		//600 is wider than screen so should be sufficient maximum
		path = 100000000;
		parent = null;
		line = l;
		adjacent = new ArrayList<Cell>();
	}
	
	//for points
	public Cell(double x, double y, double p)
	{
		midX = x;
		midY = y;
		
		path = p;
		parent = null;
		line = null;
		adjacent = new ArrayList<Cell>();
		
	}
	
	public void addAdj(Cell other)
	{
		adjacent.add(other);
	}
	
	public void setAdj(ArrayList<Cell> other)
	{
		adjacent = other;
	}
	
	public void remAdj(Cell other)
	{
		for (int k = 0; k < adjacent.size(); k++)
		{
			if (adjacent.get(k).equals(other))
			{
				adjacent.remove(k);
				break;
			}
		}
	}
	
	public void clearAdj()
	{
		adjacent.clear();
	}
	
	public double getX()
	{
		return midX;
	}
	
	public double getY()
	{
		return midY;
	}
	
	public ArrayList<Cell> getAdjacent()
	{
		return adjacent;
	}
}
